<template>
    <div>
        <!-- 面包屑 -->
        <el-bread></el-bread>
        <!-- 添加按钮 -->
        <el-button @click="add" class="btnInfo" type="primary" size="small" plain>添加</el-button>
        <!-- 列表展示 -->
        <v-list @edit="edit"></v-list>
        <!-- 弹框 -->
        <v-dialog @cancel="cancel" :isShow="isShow" :isAdd="isAdd" ref='diaInfo'></v-dialog>


    </div>
</template>

<script>
import vList from './list.vue'
import vDialog from './dialog.vue'
export default {
    data() {
        return {
            isShow: false,
            isAdd: true, //区分编辑删除
        };
    },
    components: {
        vList,
        vDialog
    },
    methods: {
        add() {
            // 打开弹框
            this.isShow = true
            // 编辑
            this.isAdd = true
        },
        cancel(e) {
            this.isShow = e
        },
        edit(e) {
            //点击 打开弹框
            this.isShow = true;
            //告诉弹框你是一个编辑
            this.isAdd = false;
            this.$refs.diaInfo.lookup(e)
        }
    }
};
</script>

<style scoped>
.btnInfo {
    margin: 20px 10px;
}
</style>
